import winsound  
import time  
  
# Base tune  
D_BASE = 264  
  
# How long a meter is  
METRE = 500  
  
DO = 0  
RE = 2  
MI = 4  
FA = 5  
SO = 7  
LA = 9  
SI = 11  
  
def Play(d, h, delay):  
    Tune = D_BASE * pow(pow(2, 1.0/12.0), d) * pow(2, h)  
    winsound.Beep(int(Tune), delay)  
  
def vibrato(d, h, delay, Times):  
    for i in range(Times):  
        Play(d    , h, METRE/(Times*2))  
        Play(d+1  , h, METRE/(Times*2))  
  
def Sleep(delay):  
    time.sleep(delay/1000.0)  
  
print "Concerto J.S. Bach (1685-1750) BWV 1043 Violin II"  
  
Play(RE    ,0,METRE/4);  
Play(MI    ,0,METRE/4);  
Play(FA    ,0,METRE/4);  
Play(SO    ,0,METRE/4);  
  
Play(LA    ,0,METRE/2);  
Play(RE    ,1,METRE/2);  
Play(DO+1  ,1,METRE/2);  
Play(LA    ,0,METRE/2);  
Play(MI    ,0,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(FA+1  ,0,METRE/2);  
Play(RE    ,0,METRE/2);  
Play(DO    ,1,int(METRE*1.50));  
  
Play(SI    ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(MI    ,0,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(SI-1  ,0,METRE/2);  
Play(RE    ,0,METRE/2);  
Play(DO+1  ,0,METRE/2);  
Play(LA    ,0,METRE/2);  
Play(RE    ,0,METRE/2);  
Play(SO    ,0,METRE/2);  
  
Play(FA    ,0,METRE);  
  
vibrato(MI ,0,METRE,5);  
  
Play(RE    ,0,METRE/4);  
Play(DO+1  ,0,METRE/4);  
Play(RE    ,0,METRE/4);  
Play(MI    ,0,METRE/4);  
Play(FA+1  ,0,METRE/4);  
Play(SO+1  ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE*2+METRE/4);  
  
Play(RE    ,1,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE*2+METRE/4);  
  
Play(DO    ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(FA    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(FA    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SO+1  ,0,METRE/4);  
Play(LA    ,0,METRE/2);  
Play(LA    ,1,METRE);  
Play(SO+1  ,1,METRE/2);  
Play(LA    ,1,METRE/2);  
  
Play(LA    ,0,METRE/4);  
Play(SO+1  ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(LA    ,0,METRE/4);  
  
Play(SI    ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO    ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
  
Play(DO+1  ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(DO+1  ,1,METRE/4);  
  
Play(RE    ,1,METRE/2);  
Play(LA    ,1,METRE/2);  
  
Sleep(METRE/2);  
  
Play(FA    ,1,METRE/2);  
Play(MI    ,1,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE*2+METRE/4);  
  
Play(DO    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(FA    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE*2+METRE/4);  
Play(RE    ,1,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(SI-1  ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SO    ,0,METRE/4);  
Play(FA    ,0,METRE/4);  
Play(MI    ,0,METRE/4);  
Play(RE    ,0,METRE/4);  
  
Play(DO    ,1,METRE/4);  
Play(SI-1  ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SO    ,0,METRE/4);  
Play(FA    ,0,METRE/4);  
Play(MI    ,0,METRE/4);  
Play(SO    ,0,METRE/4);  
  
Play(FA    ,0,METRE/2);  
Play(RE    ,0,METRE/2);  
Play(LA    ,0,METRE + METRE/4);  
  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/2);  
Play(SO    ,1,METRE/2);  
Play(FA+1  ,1,METRE/2);  
Play(RE    ,1,METRE/2);  
Play(LA    ,0,METRE/2);  
Play(DO    ,1,METRE/2);  
Play(SI    ,0,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(FA    ,1,int(METRE*1.50));  
  
Play(MI    ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
  
Play(MI    ,1,METRE/2);  
Play(DO    ,1,METRE/2);  
Play(LA    ,0,METRE/2);  
Play(DO    ,1,METRE/2);  
Play(MI-1  ,1,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(FA+1  ,0,METRE/2);  
Play(RE    ,1,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(DO    ,1,METRE/2);  
  
Play(SI-1  ,0,METRE);  
Play(LA    ,0,METRE);  
Play(SO    ,0,METRE);  
  
Sleep(METRE/2);  
  
Play(MI    ,0,METRE/2);  
Play(LA    ,0,METRE*2 + METRE/4);  
Play(SO+1  ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SI    ,0,METRE/4);  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(DO+1  ,1,METRE/4);  
  
Play(RE    ,1,METRE/4);  
Play(SI-1  ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(SO    ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
Play(FA+1  ,0,METRE/4);  
Play(SO    ,0,METRE/4);  
Play(LA    ,0,METRE/4);  
  
Play(RE    ,0,METRE/2);  
Play(SO    ,0,METRE/2);  
Play(RE    ,1,METRE + METRE/2);  
  
Play(DO+1  ,1,METRE/4);  
Play(RE    ,1,METRE/4);  
Play(MI    ,1,METRE/4);  
Play(FA    ,1,METRE/4);  
Play(SO    ,1,METRE/2 + METRE/4);  
  
Play(MI    ,1,METRE/4);  
Play(FA    ,1,METRE/4);  
Play(SO    ,1,METRE/4);  
Play(LA    ,1,METRE/2);  
Play(MI    ,1,METRE/2 + METRE/2);  
  
Play(RE    ,1,METRE);  
Play(DO+1  ,1,METRE/2);  
Play(RE    ,1,METRE);  
